<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sj" tagdir="/WEB-INF/tags/spring-jquery-tags"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<script type="text/javascript" src="<c:url value='/js/jquery/jquery.numeric.js'/>"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$("#editUserForm").validate({
			rules : {
				firstName : {
					required :true
				},
				email:{
					email:true
				}
			}
		});
		
		$("#resetUser").click(function(){
			$("#content").load("../secure/showAddUser.do");
		});
		var pickerOpts = {
				onClose : function() {
					this.focus();
				}
		};
		$(function() {
			$('#startDate').datepicker(pickerOpts);
		});   
		$(function() {
			$('#endDate').datepicker(pickerOpts);
		}); 		
		$("#startDate").val($.format.date($("#startDate").val(), "MM/dd/yyyy"));
		$("#endDate").val($.format.date($("#endDate").val(), "MM/dd/yyyy"));
		$('#phone').numeric();
		
		
	});
</script>
<div id="editUserDiv">
	<div id="menu-heading" style="margin-left:10%; margin-top:10px">
		<spring:message code="editUser.heading" />
	</div>
	<form:form name="editUserForm" id="editUserForm" action="saveUser.do" method="post" modelAttribute="user">
		<form:hidden path="id" />
		<table>
			<tr class="row">
				<td class="label">&nbsp;</td>
				<td class="input-field" colspan="2" style="text-align:center">
					<%@ include file="/common/messages.jsp" %>
				</td>
			</tr>
			<tr class="row">
				<td class="label"><spring:message code="editUser.label.firstName" /></td>
				<td class="input-field"><form:input path="firstName" cssClass="input-full-width" /></td>
				<td><form:errors path="firstName" cssClass="error" /></td>
			</tr>
			<tr class="row">
				<td class="label"><spring:message code="editUser.label.middleName" /></td>
				<td class="input-field"><form:input path="middleName" cssClass="input-full-width" /></td>
				<td><form:errors path="middleName" cssClass="error" /></td>
			</tr>
			<tr class="row">
				<td class="label"><spring:message code="editUser.label.lastName" /></td>
				<td class="input-field"><form:input path="lastName" cssClass="input-full-width" /></td>
				<td><form:errors path="lastName" cssClass="error" /></td>
			</tr>
			<tr class="row">
				<td class="label"><spring:message code="editUser.label.loginName" /></td>
				<td class="input-field"><form:input path="loginName" cssClass="input-full-width" /></td>
				<td><form:errors path="loginName" cssClass="error" /></td>
			</tr>
			<tr class="row">
				<td class="label"><spring:message code="editUser.label.password" /></td>
				<td class="input-field"><form:input path="password" cssClass="input-full-width" /></td>
				<td><form:errors path="password" cssClass="error" /></td>
			</tr>
			<tr class="row">
				<td class="label"><spring:message code="editUser.label.statusCode" /></td>
				<td class="input-field"><form:select path="statusCode">
						<form:option value="Active" label="Active" />
						<form:option value="Inactive" label="Inactive" />
					</form:select></td>
				<td><form:errors path="statusCode" cssClass="error" /></td>
			</tr>
			<tr class="row">
				<td class="label"><spring:message code="editUser.label.phone" /></td>
				<td class="input-field"><form:input path="phone" cssClass="input-full-width" /></td>
				<td><form:errors path="phone" cssClass="error" /></td>
			</tr>
			<!-- 	Adding Email Address, Start Date, EndDate to the User		 -->
			<tr class="row">
				<td class="label"><spring:message code="editUser.label.email" /></td>
				<td class="input-field"><form:input path="email" cssClass="input-full-width" /></td>
				<td><form:errors path="email" cssClass="error" /></td>
			</tr>
				<tr class="row">
				<td class="label"><spring:message code="editUser.label.startdate" /></td>
				<td class="input-field" id="startdate"><form:input path="startDate" cssClass="input-full-width" /></td>
				<td><form:errors path="startDate" cssClass="error" /></td>
			</tr>
			<tr>
				<tr class="row">
				<td class="label"><spring:message code="editUser.label.enddate" /></td>
				<td class="input-field"><form:input path="endDate" cssClass="input-full-width" /></td>
				<td><form:errors path="endDate" cssClass="error" /></td>
			</tr>
			<tr class="row">
				<td class="label"><spring:message code="editUser.label.employeeId" /></td>
				<td class="input-field"><form:input path="employeeId" cssClass="input-full-width" /></td>
				<td><form:errors path="employeeId" cssClass="error" /></td>
			</tr>
			<tr class="row">
				<td class="label">&nbsp;</td>
				<td class="input-field"><sj:submit id="loginFormSubmit" target="editUserDiv" key="editUser.button.save" validate="true" /> <input type="button" id="resetUser" value="<spring:message code='editUser.button.cancel' />" /></td>
				<td>&nbsp;</td>
			</tr>
		</table>
	</form:form>
</div>
